#! /usr/bin/env bash
#
# Create a version.ml file. Requires being in a git repo.
#
set -eu

version=$(git describe --always --dirty --tags --long)

if [[ -z "$version" ]]; then
  echo "Failed to obtain version string." >&2
  exit 1
fi

cat <<EOF
(* generated at build time by $0 *)

(*
  semgrep-core version.
*)
let version = "$version"
EOF
